/***********************************************
 **** 版权声明处 **
 ****  为了方便阅读和维护，请严格遵守相关代码规范，谢谢   ****
 *******************************************/
package bpm.graphic
{
	import flash.geom.Point;
	
	import spark.primitives.Path;

	/*******************************************
	 **** huangjixin,2012-11-15,上午11:26:19 **
	 **** 请一句话表述该类主要作用  **
	 *******************************************/
	[Style(name="radius", inherit="yes", type="Number")]//0
	
	[Style(name="curved",enumeration="true,false",inherit="no",type="Boolean",format="Boolean")]
	
	[Style(name="curveSmoothRatio",type="Number",inherit="no")]//0.65
	
	[Style(name="caps",enumeration="round,square,node",type="String",inherit="yes")]
	
	[Style(name="dashStyle",enumeration="none,dash,dot,dashDot",type="String",inherit="no")]
	
	[Style(name="dashArray",type="Array")]//array of number 
	
	[Style(name="curved",enumeration="true,false",type="Boolean",format="Boolean")]
	
	[Style(name="strokeColor", inherit="yes", type="uint")]//"black"
	
	[Style(name="strokeWidth", inherit="yes", type="uint")]//1
	
	[Style(name="endArrowType",enumeration="triangle,open,sunken,curved,square,diamond,circle,star",inherit="yes",type="String")]
	
	[Style(name="endArrowVisible",enumeration="true,false",type="Boolean",format="Boolean",inherit="yes")]
	
	[Style(name="startArrowType",enumeration="triangle,open,sunken,curved,square,diamond,circle,star",inherit="yes",type="String")]
	
	[Style(name="startArrowVisible",enumeration="true,false",format="Boolean",inherit="yes")]
	
	[Style(name="joints",enumeration="round,mitter,bevel", inherit="yes", type="String")]
	
	[Style(name="mitterLimit", inherit="yes", type="Number")]//0
	
	[Style(name="orthogonalSpacing", inherit="no", type="Number")]
	
	[Style(name="pixelHinting",enumeration="true,false", inherit="yes", type="Boolean",format="Boolean")]
	
	public class Link extends Renderer
	{
		//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
		// private 类私有静态变量和静态常量声明处。（全部大写，使用下划线进行分割）
		// 例如：private static const EXAMPLE:String = "example";
		//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
		
		//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
		// public 类公有静态变量和静态常量声明处。（全部大写，使用下划线进行分割）
		// 例如：public static const EXAMPLE:String = "example";
		//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
		
		
		//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
		// private 私有变量声明处，请以“_”开头定义变量
		// 例如：private var _example:String;
		//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
		
		
		//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
		// public 公有变量声明处
		//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
		[SkinPart]
		public var endArrow:Path;
		[SkinPart]
		public var path:Path;
		[SkinPart]
		public var startArrow:Path;
		
		public var collapsedEndPorts : Vector.<PortBase> = new Vector.<PortBase>();
		
		public var collapsedStartPorts : Vector.<PortBase> = new Vector.<PortBase>();
		
		public var decorations : Vector = new Vector();//decorations : Vector.<LinkDecoration>
		
		
		private var _endNode : Node;

		private var _endPort : PortBase;
		
		private var _fallbackEndPoint : Point = new Point();

		private var _fallbackStartPoint : Point = new Point();
		
		private var _hasFreePoints:Boolean;
		
		private var _intermediatePoints:Vector.<Point>;

		private var _shapeEndPoint:Point;
		
		private var _shapePoints:Vector.<Point>;
		
		private var _shapeStartPoint:Point;

		[Inspectable(enumeration="free,straight,orthogonal,oblique",defaultValue="orthogonal")]
		public var shapeType : String;
		
		private var _startNode : Node;

		private var _startPort : PortBase;
		
		//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
		// 构造函数，初始化相关工作可以放在里面
		//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
		public function Link(startNode:Node = null, endNode:Node = null)
		{
			super();
		}//构造函数结束
		
		
		//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
		// getter和setter函数
		//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
		
		[Bindable]
		public function get endNode():Node
		{
			return _endNode;
		}
		
		public function set endNode(value:Node):void
		{
			_endNode = value;
		}
		
		[Bindable]
		public function get endPort():PortBase
		{
			return _endPort;
		}
		
		public function set endPort(value:PortBase):void
		{
			_endPort = value;
		}

		[Bindable]
		public function get fallbackEndPoint():Point
		{
			return _fallbackEndPoint;
		}
		
		public function set fallbackEndPoint(value:Point):void
		{
			_fallbackEndPoint = value;
		}
		
		
		[Bindable]
		public function get fallbackStartPoint():Point
		{
			return _fallbackStartPoint;
		}
		
		public function set fallbackStartPoint(value:Point):void
		{
			_fallbackStartPoint = value;
		}

		public function get hasFreePoints():Boolean
		{
			return _hasFreePoints;
		}

		public function get intermediatePoints():Vector.<Point>
		{
			return _intermediatePoints;
		}
		
		public function set intermediatePoints(value:Vector.<Point>):void
		{
			_intermediatePoints = value;
		}
		
		
		public function get shapeEndPoint():Point
		{
			return _shapeEndPoint;
		}

		public function get shapePoints():Vector.<Point>
		{
			return _shapePoints;
		}
		
		public function get shapeStartPoint():Point
		{
			return _shapeStartPoint;
		}
		
		[Bindable]
		public function get startNode():Node
		{
			return _startNode;
		}
		
		public function set startNode(value:Node):void
		{
			_startNode = value;
		}
		
		
		[Bindable]
		public function get startPort():PortBase
		{
			return _startPort;
		}
		
		public function set startPort(value:PortBase):void
		{
			_startPort = value;
		}
		//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
		// 相关事件响应函数和逻辑函数存放处
		//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
		public function invalidateShape():void{
			invalidateProperties();
		}
		
		//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
		// override 覆盖函数
		//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
		override protected function commitProperties():void{
			super.commitProperties();
		}
		
		override public function styleChanged(styleProp:String):void
		{
			super.styleChanged(styleProp);
			
		}
		
		override public function stylesInitialized():void{
			super.stylesInitialized();
		}
	}//类结束
}//包结束